package com.yq.cns

import android.app.Application
import base.IAppDelegate
import com.alibaba.android.arouter.launcher.ARouter
import com.yq.skinlib.manage.SkinBuildInLoader
import com.yq.skinlib.manage.SkinCompatManager
import com.yq.skinlib.manage.SkinNoneLoader
import com.yq.skinlib.manage.SkinPrefixBuildInLoader
import config.TanHua_application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class AppApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        initSkin()
        initArouter()
        initOtherApplication()
    }

    private fun initOtherApplication() {
        val tanhuaApplication =
            ARouter.getInstance().build(TanHua_application).navigation() as IAppDelegate
        tanhuaApplication.onCreate(this)
    }



    fun initSkin() {
        SkinCompatManager.withoutActivity(this)
            .addStrategy(SkinBuildInLoader())
            .addStrategy(SkinNoneLoader())
            .addStrategy(SkinPrefixBuildInLoader())
            .loadSkin(8)

    }

    fun initArouter() {
        if (BuildConfig.DEBUG) {
            ARouter.openLog()
            ARouter.openDebug()
        }
        ARouter.init(this)
    }
}